package com.clover.coder.core;

import org.apache.commons.lang.StringUtils;

/**
 * 配置
 * <p>@Author：masl </p>
 * <p>@Date：2017年5月23日上午9:51:50 </p>
 */
public class Conf {
	//代码生成文件夹路径
	private String outPath;//"C:/Users/Administrator/Desktop/code/";// 代码生成文件夹路径
	//公司名称
	private String company;// "ddsd";// 公司名称
	//顶级包名
	private String basePackageName;// "com.msl";//顶级包名
	//子包名
	private String subPackageName;// "sys";//子包名
	//当前操作人
	private String author;//"masl";//当前操作人
	//模板文件夹名称
	private String templeteDirName;// "createCode";//模板文件夹名称
	//数据库驱动
	private String dbDriver;
	//数据库 url
	private String dbUrl;
	//数据库用户名
	private String dbUserNa;
	//数据库密码
	private String dbPwd;
	//数据库类型
	private DataBaseType dbType;

	public String getDbDriver() {
		if (StringUtils.isEmpty(dbDriver)) {
			dbDriver = "com.mysql.jdbc.Driver";
		}
		return dbDriver;
	}

	public Conf setDbDriver(String dbDriver) {
		this.dbDriver = dbDriver;
		return this;
	}

	public String getDbUrl() {
		return dbUrl;
	}

	public Conf setDbUrl(String dbUrl) {
		this.dbUrl = dbUrl;
		return this;
	}

	public String getDbUserNa() {
		if (StringUtils.isEmpty(dbUserNa)) {
			dbUserNa = "root";
		}
		return dbUserNa;
	}

	public Conf setDbUserNa(String dbUserNa) {
		this.dbUserNa = dbUserNa;
		return this;
	}

	public String getDbPwd() {
		return dbPwd;
	}

	public Conf setDbPwd(String dbPwd) {
		this.dbPwd = dbPwd;
		return this;
	}

	public DataBaseType getDbType() {
		if (dbType == null) {
			dbType = DataBaseType.mysql;
		}
		return dbType;
	}

	public Conf setDbType(DataBaseType dbType) {
		this.dbType = dbType;
		return this;
	}

	public String getOutPath() {
		if (outPath == null) {
			outPath = "c://code";
		}
		return outPath;
	}

	public Conf setOutPath(String outPath) {
		this.outPath = outPath;
		return this;
	}

	public String getCompany() {
		return company;
	}

	public Conf setCompany(String company) {
		this.company = company;
		return this;
	}

	public String getBasePackageName() {
		return basePackageName;
	}

	public Conf setBasePackageName(String basePackageName) {
		this.basePackageName = basePackageName;
		return this;
	}

	public String getSubPackageName() {
		return subPackageName;
	}

	public Conf setSubPackageName(String subPackageName) {
		this.subPackageName = subPackageName;
		return this;
	}

	public String getAuthor() {
		return author;
	}

	public Conf setAuthor(String author) {
		this.author = author;
		return this;
	}

	public String getTempleteDirName() {
		if (templeteDirName == null) {
			templeteDirName = "createCode";
		}
		return templeteDirName;
	}

	public Conf setTempleteDirName(String templeteDirName) {
		this.templeteDirName = templeteDirName;
		return this;
	}
}
